package com.mervin.patterns.prototype;

/***************************************
 * @Auther: mervin
 * @Date: 2020-04-18 00:26
 * @Description: 个人简历
 ***************************************/
public class Resume implements Cloneable {

    private String name;
    private String sex;
    private String mobile;

    private WorkExperience workExperience;

    public Resume(String name, String sex, String mobile) {
        this.name = name;
        this.sex = sex;
        this.mobile = mobile;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public WorkExperience getWorkExperience() {
        return workExperience;
    }

    public void setWorkExperience(WorkExperience workExperience) {
        this.workExperience = workExperience;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Resume cloneObj = (Resume)super.clone();
        // 实现深拷贝
        cloneObj.setWorkExperience((WorkExperience) this.workExperience.clone());
        return cloneObj;
    }

    @Override
    public String toString() {
        return "Resume = {" +
                "name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", mobile='" + mobile + '\'' +
                ", " + workExperience.toString() +
                '}';
    }
}
